package com.cqjtu.eecs.mapper;

import com.cqjtu.eecs.entity.Course;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author
 * @since 2022-02-28
 */
@Mapper
@Repository
public interface CourseMapper extends BaseMapper<Course> {

    int updateCourseByCourseCode(Integer id,Course course);
    ArrayList<Course> selectAllCourse();
    // 通过courseCodeList去查询CourseList
    List<Course> listCourseByIdList(@Param("ids")List<Integer> ids);
    int deletCourseById(Integer id);

    /**
     * 获取sheet表中所有课程在数据库中的课程名称代码键值对
     * @param names
     * @param majorCode
     * @param versionCode
     * @return
     */
    List<Map<String, Object>> listCourseNameCodeMapByNameVersionCodeAndMajorCode(@Param("names") List<String> names, @Param("majorCode") String majorCode, @Param("versionCode") String versionCode);

    int selectAllCourseSum();

    Course selectCourseByCourseName(String courseName);

    List<Course> selectAllCourselimit(int currPage, int pageSize);

    List<Course> selectAllCourseByLike(String courseName);
}
